/**
 * 
 */
package com.maohi.software.arii;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.maohi.software.arii.exceptions.ActivatorException;
import com.maohi.software.arii.interfaces.Activator;

/**
 * @author heifara
 * 
 */
public class ActivatorHandler {
	private static Logger logger = Logger.getLogger(ActivatorHandler.class.getName());
	private final List<Activator> activators;

	public ActivatorHandler() {
		this.activators = new ArrayList<Activator>();
	}

	public void initActivators(List<Activator> instance) {
	}

	public void startActivators(List<Activator> aActivators) throws ActivatorException {
		for (Activator iActivator : aActivators) {
			iActivator.start();
			this.activators.add(iActivator);
			logger.debug(String.format("Activator[%s]", iActivator));
		}
	}

	public void stopActivators() throws ActivatorException {
		for (Activator iActivator : this.activators) {
			iActivator.stop();
			logger.debug(String.format("Activator[%s]", iActivator));
		}
	}

}
